package com.windoent.yugioh.adapter.brvah;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.windoent.yugioh.R;
import com.windoent.yugioh.bean.Notificationsbean;
import com.windoent.yugioh.utils.BaseMethod;

/**
 * author : robert
 * date   : 2021/5/6 15:26
 * desc   :系统
 */
public class SystemNotificationAdapter extends BaseQuickAdapter<Notificationsbean.DataBean.ResBean, BaseViewHolder> {

    public SystemNotificationAdapter() {
        super(R.layout.item_list_sysytm_notification, null);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Notificationsbean.DataBean.ResBean item) {
        helper.setText(R.id.tv_system_time, BaseMethod.notNullDefaultValueNull(item.getVistor_time()))
                .setText(R.id.tv_content, BaseMethod.notNullDefaultValueNull(item.getContent()));
        ImageView view = helper.getView(R.id.iv_system_notification);
        TextView tv_system_time = helper.getView(R.id.tv_system_time);
        TextView tv_content = helper.getView(R.id.tv_content);
        TextView tv_system_title = helper.getView(R.id.tv_system_title);
        boolean is_view = item.isIs_view();//查看过
        view.setBackgroundResource(is_view ? R.drawable.drawable_notification_system_gray : R.drawable.drawable_notification_system);
        tv_system_title.setSelected(is_view);
        tv_system_time.setSelected(is_view);
        tv_content.setSelected(is_view);
    }
}